In advanced technology nodes of integrated circuit industry, high k dielectric material and metal are adopted to form a metal gate stack of metal-oxide-semiconductor field-effect transistors (MOSFETs). In a method to form a metal gate stack, a metal layer is deposited and etched. During the metal etch, the etch processing window is not enough and the photoresist (resist) may experience a peeling issue at the metal etch step. The exposed metal film cannot be completely etched away and the patterned resist can be peeled from the underlying metal film. The wet etch solution can penetrate to the interface between the patterned resist and the metal film and oxidize the metal film underlying the patterned resist. This further changes the metal film and degrades the device performance.